const statDao = require('../dao/statDao');

const statService = {
    /*
     * 获取统计结果
     */
    async getStatInfo() {
        let result;
        try {
            result = await statDao.getStatInfo();
        } catch (err) {
            console.log(err);
            result = null;
        }
        return result;
    },
    /*
     * 获取曲线统计结果
     */
    async curveInfo() {
        let result;
        try {
            result = await statDao.curveInfo();
            result = { success: true, msg: "查询成功", result: { consult: result[0], assess: result[1] } };
        } catch (error) {
            result = { success: false, msg: "操作数据库时出错，查询失败" };
        }
        return result;
    }
};

module.exports = statService;
